package com.cameron.orderdemo;

import android.os.Parcel;
import android.os.Parcelable;

public class GoodsInfo implements Parcelable {
	public long   _id;
	public String market_name;
	public String store_name;
	public String record_date_time;
	public String goods_type;
	public String goods_name;
	public String measure_unit;
	public String goods_color;
	public String goods_size;
	public String goods_price;
	public String goods_amount;
	public String delivery_date;
	public String remarks;	 
	public String goods_photo;

	// From Parcelable
	@Override
	public int describeContents()
    {
		return 0;
	}

    public GoodsInfo() {
    	this._id = -1;
    	this.market_name = "";
    	this.store_name = "";
    	this.record_date_time = "";
    	this.goods_type = "";
    	this.goods_name = "";
    	this.measure_unit = "";
    	this.goods_color = "";
    	this.goods_size = "";
    	this.goods_price = "";
    	this.goods_amount = "";
    	this.delivery_date = "";
    	this.goods_photo = "";
    	this.remarks = "";
    }
    
    public void setDataTimeField(String datatime) {
    	this.record_date_time = datatime;
    }

    public GoodsInfo(Parcel in) {
    	this._id = in.readLong();
    	this.market_name = in.readString();
    	this.store_name = in.readString();
    	this.record_date_time = in.readString();
    	this.goods_type = in.readString();
    	this.goods_name = in.readString();
    	this.measure_unit = in.readString();
    	this.goods_color = in.readString();
    	this.goods_size = in.readString();
    	this.goods_price = in.readString();
    	this.goods_amount = in.readString();
    	this.delivery_date = in.readString();
    	this.goods_photo = in.readString();
    	this.remarks = in.readString();
    }

	// From Parcelable
	@Override
	public void writeToParcel(Parcel dest, int flags)
	{
		dest.writeLong(_id);
	    dest.writeString(market_name);
	    dest.writeString(store_name);
	    dest.writeString(record_date_time);
	    dest.writeString(goods_type);
	    dest.writeString(goods_name);
	    dest.writeString(measure_unit);
	    dest.writeString(goods_color);
	    dest.writeString(goods_size);
	    dest.writeString(goods_price);
	    dest.writeString(goods_amount);
	    dest.writeString(delivery_date);
	    dest.writeString(goods_photo);
	    dest.writeString(remarks);
	}

	 

	public static final Parcelable.Creator<GoodsInfo> CREATOR = new Parcelable.Creator<GoodsInfo>() {
	    // From Parcelable.Creator
        @Override
        public GoodsInfo createFromParcel(Parcel in)
        {
        	GoodsInfo brief = new GoodsInfo(in);
            /*brief.market_name = in.readString();
            brief.store_name = in.readString();
            brief.record_date = in.readString();
            brief.goods_name = in.readString();
            brief.measure_unit = in.readString();
            brief.goods_color = in.readString();
            brief.goods_size = in.readString();
            brief.record_date = in.readString();
            brief.goods_price = in.readString();
            brief.delivery_date = in.readString();
            brief.goods_photo = in.readString();
            brief.remarks = in.readString();*/

            return brief;
        }

        // From Parcelable.Creator
        @Override
        public GoodsInfo[] newArray(int size)
        {
        	return new GoodsInfo[size];
        }

	};

    public String toString() {
        return "GoodsInfo {id=" + _id + "goods_name=" + goods_name + ", store_name=" + store_name + "}";
    }
}
